package com.example.red_tea_house.moudle.LoginAndRegister.view;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.example.red_tea_house.MyApplication;
import com.example.red_tea_house.R;
import com.example.red_tea_house.annotation.HandlerType;
import com.example.red_tea_house.moudle.LoginAndRegister.controller.VertifyLoginController;
import com.example.red_tea_house.util.ToastUtil;

public class VertifyLoginActivity extends AppCompatActivity {
    private Button sendVertifyCode;
    private Button vertifyLogin;
    private Button returnLogin;
    private TextView phoneInput;
    private TextView vertifyCodeInput;

    private VertifyLoginController vertifyLoginController=new VertifyLoginController(this);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.identifying_code_login);

        bindItems();

        sendVertifyCode.setOnClickListener((v)-> vertifyLoginController.getIdentifycode(phoneInput.getText().toString()));

        vertifyLogin.setOnClickListener((v)-> vertifyLoginController.sendJudgeRequest(vertifyCodeInput.getText().toString(),phoneInput.getText().toString()));

        returnLogin.setOnClickListener((v)-> finish());
    }

    private void bindItems(){
        sendVertifyCode=findViewById(R.id.gain_identifying_code_1);
        vertifyLogin=findViewById(R.id.btn_login_1);
        phoneInput=findViewById(R.id.register_phone_1);
        vertifyCodeInput =findViewById(R.id.input_identifying_code_1);
        returnLogin=findViewById(R.id.password_login_1);
    }
}

